{!capture name='main'!}
{!include file='settings/head.tpl' showType='face'!}
{!/capture!}
{!capture name='left'!}
	<script type="text/javascript">
		function onUploadOver() {
			var c = document.getElementById('frmUpload').contentWindow.document.body.innerHTML;
			if (c == "1") {
				frames["frmFace"].location.reload();
				$('#uploadPicture').val('');
				$('#btnUpload').attr('disabled',false);
			}
		}
	</script>
	<form enctype="multipart/form-data" method="post" action="/action/face_modify" target="frmUpload" onsubmit="return onSubmit(this);">
	<input type="hidden" name="MAX_FILE_SIZE" value="2000000"/>
	<table cellspacing="4" cellpadding="0" border="0" width="100%">
		<tr>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td class="r">头像：</td>
			<td><input type="file" name="picture" id="uploadPicture" size="40"/><span class="g">不超过2M</span></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" value="修改" id="btnUpload"/></td>
		</tr>
	</table>
	</form>
	<iframe id="frmUpload" name="frmUpload" frameborder="0"  scrolling="no" style="width:0px;height:0px;" onload="onUploadOver()"></iframe>
{!/capture!}
{!capture name='jsCode'!}
{!if $isMyself!}
<script type="text/javascript">
function modifyNickname() {
	var _old = $('#nicknameLink').text();
	var _new = prompt("请输入新的昵称", _old);
	if (_new != null && _new != _old) {
		$.post("/action/nickname_modify", {'new':_new}, function(ret){
			if (ret == 1) {
				$('.nickname').text(_new);
			} else {
				alert(ret);
			}
		});
	}
}
function onSubmit(form) {
	var p = $(form.picture).val();
	if (!$.trim(p)) {
		form.picture.focus();
		return false;
	}
	if (!/\.(gif|jpg)$/i.test(p)) {
		form.picture.select();
		alert("图片必须为gif或者jpg格式");
		return false;
	}
	$('#btnUpload').attr('disabled',true);
	return true;
}
</script>
{!/if!}
{!/capture!}

{!include file='layouts/default.tpl'!}